# Author:Li

from apps.utils.captcha import Captcha
from apps.utils.tools import random_string
import base64
import redis


def get_captcha():
    code = random_string()
    image_data = Captcha.instance().generate(code, fmt='PNG')
    print(base64.b64encode(image_data))


def redis_test():
    r = redis.Redis(host="localhost", port=6379, password="123456", db=0, charset="utf8", decode_responses=True)
    r.set("mobile", "123")
    r.expire("mobile", 1)
    import time
    time.sleep(1)
    print(r.get("mobile"))


if __name__ == '__main__':
    # get_captcha()
    # redis_test()
    pass